export const useKeepAliveStore = defineStore('keepAlive', () => {
  const keepAliveNames = ref([]);

  const add = (name) => {
    if (!keepAliveNames.value.includes(name)) {
      keepAliveNames.value.push(name);
    }
  };

  const remove = (name) => {
    keepAliveNames.value = keepAliveNames.value.filter((item) => item !== name);
  };

  const clear = () => {
    keepAliveNames.value = [];
  };

  return {
    keepAliveNames,
    add,
    remove,
    clear,
  };
});
